﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rad_Studio_Keygen
{
    public struct RadStudioVersion
    {
        public string Name { get; private set; }
        public string Ver { get; private set; }
        public string BDSVersion { get; private set; }
        public string LicVerStr { get; private set; }
        public int LicHostPID { get; private set; }
        public int LicHostSKU { get; private set; }
        public string LicDelphiPID { get; private set; }
        public string LicCBuilderPID { get; private set; }
        public PatchInfo BdsPatchInfo { get; private set; }
        public PatchInfo LicenseManagerPatchInfo { get; private set; }
        public PatchInfo mOasisRuntimePatchInfo { get; private set; }
        public string SetupGUID { get; private set; }
        public string ISOUrl { get; private set; }
        public string ISOMd5 { get; private set; }
        public string SetupProcessName { get; private set; }

        public static Dictionary<string, RadStudioVersion> RadStudioVersionList = new Dictionary<string, RadStudioVersion>();

        static RadStudioVersion()
        {
            var rsv = new RadStudioVersion()
            {
                Name = "RAD Studio 10.4.1 Sydney",
                Ver = "27.0.38860.1461",
                BDSVersion = "21.0",
                LicVerStr = "10.4",
                LicHostPID = 8221,
                LicHostSKU = 52,
                LicDelphiPID = "2027",
                LicCBuilderPID = "4024",
                BdsPatchInfo = new PatchInfo()
                {
                    Crc = 0x8F7C1627,
                    Sha1 = "EAE45253CE6A6E7A770406A52D4F0EFBDD467128",
                    PatchOffset = 0x01FD7C,
                    FinalizeArrayOffset = 0x124BDC
                },
                LicenseManagerPatchInfo = new PatchInfo()
                {
                    Crc = 0x5C14D67C,
                    Sha1 = "029C2F57E3BF2456FCCAE543252083F1D1B20D73",
                    PatchOffset = 0x156320,
                    FinalizeArrayOffset = 0x5A07A4
                },
                mOasisRuntimePatchInfo = new PatchInfo()
                {
                    Sha1 = "101FC6D71A1DDEAF3B079477560DD0307ADE3C80",
                    PatchOffset = 0x0016CFE9
                },
                //SetupGUID = "{426A3606-6CB8-4CF8-87A8-44388377C47D}",
                ISOUrl = "https://altd.embarcadero.com/download/radstudio/10.4/radstudio_10_4_101461a.iso",
                ISOMd5 = "952f87f0001d5a5e2310cbc8b5d7febf",

                SetupProcessName = "radstudio_10_4_esd_101461a.tmp"
            };
            RadStudioVersionList.Add(rsv.Name , rsv);
        }
    }

    public struct PatchInfo
    {
        public uint Crc;
        public string Sha1;
        public uint PatchOffset;
        public uint FinalizeArrayOffset;
    }
}
